
MACRO (GET_CURRENT_TIME RESULT)
    IF (WIN32)
        EXECUTE_PROCESS(COMMAND "cmd" " /C date /T" OUTPUT_VARIABLE ${RESULT})
        string(REGEX REPLACE "(..)/(..)/..(..).*" "\\1/\\2/\\3" ${RESULT} ${${RESULT}})
    ELSEIF(UNIX)
        EXECUTE_PROCESS(COMMAND "date" OUTPUT_VARIABLE ${RESULT})
        string(REPLACE "\n" "" ${RESULT} ${${RESULT}})
    ELSE (WIN32)
        MESSAGE(SEND_ERROR "date not implemented")
        SET(${RESULT} 000000)
    ENDIF (WIN32)
ENDMACRO (GET_CURRENT_TIME)

MACRO (GET_USER RESULT)
    IF (WIN32)
        set(${RESULT} "$ENV{USERNAME}")
    ELSEIF(UNIX)
        set(${RESULT} "$ENV{USER}")
    ELSE ()
        MESSAGE(SEND_ERROR "user unknown")
        SET(${RESULT} "unknown")
    ENDIF ()
ENDMACRO (GET_USER)

function(GenerateReleaseNote svnRoot projectName tagName changelog)
    GET_USER(user)
    GET_CURRENT_TIME(time)
    
    set(${changelog} "${tagName} (${user} on ${time})" PARENT_SCOPE)
endfunction(GenerateReleaseNote)